<?PHP
//error_reporting(0);
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
$DOCUMENT_ROOT=$_SERVER["DOCUMENT_ROOT"].'/tunes/';

include('KernCMS.php');
include("Haeder.html");
include("DatabaesConnection.php");
//tags
$tagID=1;
if(!empty($_GET["tag"])){
	$tagID=$_GET["tag"];
	$R_MoudeTagID = empty($_GET["MoudeTagID"]) ? NULL : $_GET["MoudeTagID"];
	$R_Page = empty($_GET["page"]) ? NULL : $_GET["page"];
}else if(!empty($_POST["tag"])){
	$tagID=$_POST["tag"];
	$R_MoudeTagID=$_POST["MoudeTagID"];
	$R_Page=$_POST["page"];
}

//style tags
$sql="select style from tags where id=$tagID";
$_rd= mysql_query($sql,$_db_link);
if($_rd){
	if($daten = mysql_fetch_array($_rd, MYSQL_ASSOC)){
		if($daten["style"]!=NULL){
			echo '<link rel="stylesheet" type="text/css" href="css/'.$daten["style"].'.css">';
		}
	}
}
//User Control
if(empty($_SESSION["User_Admin"]))
	$_SESSION["User_Admin"]=0;
if(!empty($_POST["username"]) && !empty($_POST["password"])){
	$sql="select * from user where UserName='".$_POST["username"]."' and Password='".$_POST["password"]."'";
	$_rd= mysql_query($sql,$_db_link);
	if($daten = mysql_fetch_array($_rd, MYSQL_ASSOC)){
		$_SESSION["CMS_User"]=$daten;
		$sql="select rol.ID,rol.Rolname,userrol.UserID from userrol,rol where userrol.UserID=".$daten["ID"]." and userrol.RolID=rol.ID";
		$_rd= mysql_query($sql,$_db_link);
		while($daten = mysql_fetch_array($_rd, MYSQL_ASSOC)){
			$_SESSION["CMS_UserRol"][]=$daten;
			if($daten["Rolname"]=="Admin"){
				$_SESSION["User_Admin"]=1;
			}

		}
	}else{
		echo '-----------';
	}
}else if(!empty($_GET["singout"])){
	unset($_SESSION["CMS_User"]);
	unset($_SESSION["CMS_UserRol"]);
	$_SESSION["User_Admin"] = 0;
}
function UserHatRol($Rol){
	if($Rol=="Unknown")return 1;
	if(isset($_SESSION["CMS_User"])){
		foreach($_SESSION["CMS_UserRol"] as $URol){
			if($URol["Rolname"]==$Rol){
				return 1;
			}
		}
	}
	return 0;
}
function UserHatRolID($RolID){
	if($RolID==1) return 1;
	if(isset($_SESSION["CMS_User"])){
		foreach($_SESSION["CMS_UserRol"] as $URol){
			if($URol["ID"]==$RolID){
				return 1;
			}
		}
	}
	return 0;
}
//User Controler End
?>

<?php 


if(!empty($_SESSION["User_Admin"]) || (isset($_sw_tagEdit) && $_sw_tagEdit==1)){ ?>

<?PHP include("AdminPanel.php"); ?>

<?PHP  } ?>
<?php
	$teamplatName = "paris"; 
	include("template/".$teamplatName.".php");
?>
<!-- <div class="general" id="top"> -->

<!-- 	<table cellspacing="0" cellpadding="0" class="central"> -->

<!-- 		<tr class="main_central_flash"> -->
<!-- 			<td class="heightHeader"> -->
<!-- 				<div class="bandeau"> -->
					<?php 
// 					include("SpracheView.php");
// 					?>
					<?php
// 					 include("Menu.php");
// 					 ?>
<!-- 				</div> -->
<!-- 			</td> -->
<!-- 		</tr> -->
<!-- 		<tr class="main_central_flash2" valign="top"> -->
<!-- 			<td> -->
<!-- 				<div> -->
					<?php
// 					if( ($_SESSION["User_Admin"]==1) && !empty($_GET["edit"]) )
// 						include("ModuleEdit.php");
// 					else
// 						include("ModuleLoader.php");




// 					?>
<!-- 				</div> -->
<!-- 			</td> -->
<!-- 		</tr> -->
<!-- 		<tr> -->
<!-- 			<td class="footer"> -->
				<!-- footer -->
<!-- 			</td> -->
<!-- 		</tr> -->
<!-- 	</table> -->
<!-- </div> -->
<!-- MapDiv -->
